package com.fh.service.impl;/**
 * 描述:
 * Author:袁亚强
 * Date:2021/11/2415:32
 */

import com.fh.entity.po.Brand;
import com.fh.mappers.BrandMapper;
import com.fh.service.BrandService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.Date;
import java.util.List;

/**
 * created by macro on 2021/11/24,
 */
@Service
public class BrandServiceImpl implements BrandService {
    @Resource
    private BrandMapper brandMapper;
    @Override
    public List<Brand> queryAllBrandData() {
        return brandMapper.queryAllBrandData();
    }

    @Override
    public Brand queryById(Integer id) {
        return brandMapper.queryById(id);
    }

    @Override
    public void updateBrand(Brand brand) {
        brandMapper.updateBrand(brand);
    }

    @Override
    public void addBrand(Brand brand) {
        brand.setCreateDate(new Date());
        brand.setIsdel(0);
        brandMapper.addBrand(brand);
    }

    @Override
    public Integer queryByName(String name) {
        return brandMapper.queryByName(name)!=null?0:1;
    }
}
